<template>
  <div id="login">
    <el-card class="box-card" shadow="hover">
      <template #header>
        <div class="card-header">
          <span>登 出</span>
        </div>
      </template>
      <div id="text">
        <span>退出成功！</span>
        <span>返回登录界面</span>
        <span>倒计时{{time}}</span>
      </div>
    </el-card>
  </div>
</template>

<script>
export default {
  name: 'AppLogout',
  components: {

  },
  data () {
    return {
      time: 5,
      timer: null
  }},
  methods: {
    
  },
  mounted () {
    // window.location.reload()
    this.timer = setInterval(() => {
      this.time -= 1
    }, 1000)
  },
  watch: {
    'time' (newValue) {
      if (newValue === 0) {
        clearInterval(this.timer)
        this.time = 0
        this.$router.push({path:'/login'})
      }
    }
  }
}
</script>

<style scoped>
#text span {
  margin: 10px;
}
#login {
  width: 100%;
  height: 100%;
  background-image: url('../assets/cool-background.png');
  background-repeat: no-repeat;
  background-position: left center;
  background-size: cover;
  display: flex;
	justify-content: center;
	align-items: center;
}
#submit-btn {
  margin-top: 20px;
  margin-left: 70px;
  width: 320px;
}
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-header span {
  font-family: 'PingFang SC';
  font-weight: 300;
  font-size: 24px;
}

.text {
  font-size: 14px;
}

.item {
  margin-bottom: 18px;
}

.box-card {
  width: 480px;
  opacity: 0.8;
}
</style>
